package com.xbongbong.pro.businessrule.pojo;

import com.xbongbong.paas.domain.entity.PaasFormExplainEntity;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.pro.form.pojo.RuleTargetPojo;
import com.xbongbong.saas.domain.entity.WorkOrderExplainEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.Map;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2019/9/20 15:02
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class BusinessRuleInfoPojo implements Serializable {

    private static final long serialVersionUID = -3774808084271664496L;

    private String corpid;
    /**
     * 本表单字段解释容器
     */
    private Map<String, FieldAttrEntity> thisExplainMap;

    private Map<String, FieldAttrEntity> targetExplainMap;

    private Map<Long, PaasFormExplainEntity> formExplainMap;


    private Map<Long, WorkOrderExplainEntity> workOrderExplainMap;

    private RuleTargetPojo ruleTargetPojo;

    private Long formId;
    /**
     * 本表单业务类型
     */
    private Integer businessType;
    /**
     * 本表单业务标识
     */
    private Integer saasMark;

    private Integer operationType;

    private Object object;
    /**
     * 关联数据的数据集合
     */
    private Map<String, PaasFormDataEntityExt> formDataMap;

    public BusinessRuleInfoPojo() {
    }

    public BusinessRuleInfoPojo(String corpid, Long formId, Integer businessType, Integer saasMark, Map<String, FieldAttrEntity> thisExplainMap) {
        this.corpid = corpid;
        this.formId = formId;
        this.businessType = businessType;
        this.saasMark = saasMark;
        this.thisExplainMap = thisExplainMap;
    }

    public BusinessRuleInfoPojo(String corpid, Map<String, FieldAttrEntity> thisExplainMap, Map<String, FieldAttrEntity> targetExplainMap, RuleTargetPojo ruleTargetPojo, Long formId, Integer businessType, Integer saasMark, Integer operationType, Map<String, PaasFormDataEntityExt> formDataMap) {
        this.corpid = corpid;
        this.thisExplainMap = thisExplainMap;
        this.targetExplainMap = targetExplainMap;
        this.ruleTargetPojo = ruleTargetPojo;
        this.businessType = businessType;
        this.saasMark = saasMark;
        this.operationType = operationType;
        this.formDataMap = formDataMap;
        this.formId = formId;
    }

    public BusinessRuleInfoPojo(Long formId, String corpid, Integer businessType, Map<String, FieldAttrEntity> thisExplainMap) {
        this.formId = formId;
        this.corpid = corpid;
        this.businessType = businessType;
        this.thisExplainMap = thisExplainMap;
    }
    public BusinessRuleInfoPojo(Long formId, String corpid, Integer businessType, Map<String, FieldAttrEntity> thisExplainMap,Map<String, PaasFormDataEntityExt> formDataMap) {
        this.formId = formId;
        this.corpid = corpid;
        this.businessType = businessType;
        this.thisExplainMap = thisExplainMap;
        this.formDataMap = formDataMap;
    }

    /**
     * 进行动态值比较的传参
     * @param formId 当前表单id
     * @param corpid 公司id
     * @param businessType 业务类型
     * @param formDataMap 关联数据入参 key的格式为 业务类型_数据id {"100_1": {"id": 1, "data": {}, "serailNo": ""}}
     */
    public BusinessRuleInfoPojo( String corpid, Long formId, Integer businessType, Map<String, PaasFormDataEntityExt> formDataMap) {
        this.formId = formId;
        this.corpid = corpid;
        this.businessType = businessType;
        this.formDataMap = formDataMap;
    }
}
